package fr.syntheses.blog.Model.DAO;


import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.Session;

/**
 * @author Altenide-mov
 *
 */
public class HibernateUtil {

	/**
	 * 
	 */
	private static SessionFactory sessionFactory;

	/**
	 * 
	 */
	@SuppressWarnings("deprecation")
	public static void createSessionFactory() {
		sessionFactory = new Configuration().configure().buildSessionFactory();
	}

	/**
	 * @return Session
	 */
	public static Session getSession() {
		return sessionFactory.openSession();
	}
	
	/**
	 */
	public static void closeSession() {
		getSession().close();
	}
	
}
